package jmine.tec.report.cell.impl;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.NumberFormat;

import jmine.tec.report.cell.DataCell;

/**
 * @author adalberto
 */
public class CurrencyDataCell extends AbstractDoubleValueDataCell implements DataCell, Serializable {
    private static final long serialVersionUID = 4450498120790730591L;

    // FIXME add reference to $$

    /**
     * Construtor
     * 
     * @param value Double
     */
    public CurrencyDataCell(final Double value) {
        super(value);
    }

    /**
     * Construtor with primitive
     * 
     * @param value Double
     */
    public CurrencyDataCell(final double value) {
        super(value);
    }

    /**
     * Retorna uma string usando o currencyFormat recebido
     * 
     * @param dateFormat DateFormat
     * @param doubleFormat NumberFormat
     * @param currencyFormat NumberFormat
     * @return String
     */
    public String toString(final DateFormat dateFormat, final NumberFormat doubleFormat,
            final NumberFormat currencyFormat) {
        if (currencyFormat != null) {
            return currencyFormat.format(this.toDouble());
        } else {
            return this.toDouble().toString();
        }

    }

}
